home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
mach
/
amiga
/
tools
/
gcc040pd.lha
/
as.info-2
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
GNU Info File
|
1992-09-30
|
33.1 KB
|
1,036 lines
This is Info file as.info, produced by Makeinfo-1.43 from the input
file as-680x0.texinfo.
This file documents the GNU Assembler "as".
Copyright (C) 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the section entitled "GNU General Public License" is included
exactly as in the original, and provided that the entire resulting
derived work is distributed under the terms of a permission notice
identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public
License" may be included in a translation approved by the Free
Software Foundation instead of in the original English.
File: as.info, Node: Infix Ops, Prev: Prefix Ops, Up: Integer Exprs
Infix Operators
---------------
"Infix operators" take two arguments, one on either side. Operators
have precedence, but operations with equal precedence are performed
left to right. Apart from `+' or `-', both arguments must be
absolute, and the result is absolute.
1. Highest Precedence
`*'
"Multiplication".
`/'
"Division". Truncation is the same as the C operator `/'
`%'
"Remainder".
`<'
`<<'
"Shift Left". Same as the C operator `<<'
`>'
`>>'
"Shift Right". Same as the C operator `>>'
2. Intermediate precedence
`|'
"Bitwise Inclusive Or".
`&'
"Bitwise And".
`^'
"Bitwise Exclusive Or".
`!'
"Bitwise Or Not".
3. Lowest Precedence
`+'
"Addition". If either argument is absolute, the result has
the section of the other argument. If either argument is
pass1 or undefined, the result is pass1. Otherwise `+' is
illegal.
`-'
"Subtraction". If the right argument is absolute, the
result has the section of the left argument. If either
argument is pass1 the result is pass1. If either argument
is undefined the result is difference section. If both
arguments are in the same section, the result is
absolute--provided that section is one of text, data or bss.
Otherwise subtraction is illegal.
The sense of the rule for addition is that it's only meaningful to
add the *offsets* in an address; you can only have a defined section in
one of the two arguments.
Similarly, you can't subtract quantities from two different
sections.
File: as.info, Node: Pseudo Ops, Next: M68K-Dependent, Prev: Expressions, Up: Top
Assembler Directives
********************
All assembler directives have names that begin with a period (`.').
The rest of the name is letters, usually in lower case.
This chapter discusses directives present regardless of the target
machine configuration for the GNU assembler. *Note M68K-Dependent::
for additional directives.
* Menu:
* Abort:: `.abort'
* Align:: `.align ABS-EXPR , ABS-EXPR'
* App-File:: `.app-file STRING'
* Ascii:: `.ascii "STRING"'...
* Asciz:: `.asciz "STRING"'...
* Byte:: `.byte EXPRESSIONS'
* Comm:: `.comm SYMBOL , LENGTH '
* Data:: `.data SUBSECTION'
* Desc:: `.desc SYMBOL, ABS-EXPRESSION'
* Double:: `.double FLONUMS'
* Eject:: `.eject'
* Else:: `.else'
* Endif:: `.endif'
* Equ:: `.equ SYMBOL, EXPRESSION'
* Extern:: `.extern'
* File:: `.file STRING'
* Fill:: `.fill REPEAT , SIZE , VALUE'
* Float:: `.float FLONUMS'
* Global:: `.global SYMBOL', `.globl SYMBOL'
* hword:: `.hword EXPRESSIONS'
* Ident:: `.ident'
* If:: `.if ABSOLUTE EXPRESSION'
* Include:: `.include "FILE"'
* Int:: `.int EXPRESSIONS'
* Lcomm:: `.lcomm SYMBOL , LENGTH'
* Lflags:: `.lflags'
* Line:: `.line LINE-NUMBER'
* Ln:: `.ln LINE-NUMBER'
* List:: `.list'
* Long:: `.long EXPRESSIONS'
* Lsym:: `.lsym SYMBOL, EXPRESSION'
* Nolist:: `.nolist'
* Octa:: `.octa BIGNUMS'
* Org:: `.org NEW-LC , FILL'
* Psize:: `.psize LINES, COLUMNS'
* Quad:: `.quad BIGNUMS'
* Sbttl:: `.sbttl "SUBHEADING"'
* Set:: `.set SYMBOL, EXPRESSION'
* Short:: `.short EXPRESSIONS'
* Single:: `.single FLONUMS'
* Space:: `.space SIZE , FILL'
* Stab:: `.stabd, .stabn, .stabs'
* Text:: `.text SUBSECTION'
* Title:: `.title "HEADING"'
* Word:: `.word EXPRESSIONS'
* Deprecated:: Deprecated Directives
File: as.info, Node: Abort, Next: Align, Prev: Pseudo Ops, Up: Pseudo Ops
`.abort'
========
This directive stops the assembly immediately. It is for
compatibility with other assemblers. The original idea was that the
assembly language source would be piped into the assembler. If the
sender of the source quit, it could use this directive tells `as' to
quit also. One day `.abort' will not be supported.
File: as.info, Node: Align, Next: App-File, Prev: Abort, Up: Pseudo Ops
`.align ABS-EXPR , ABS-EXPR'
============================
Pad the location counter (in the current subsection) to a particular
storage boundary. The first expression (which must be absolute) is the
number of low-order zero bits the location counter will have after
advancement. For example `.align 3' will advance the location counter
until it a multiple of 8. If the location counter is already a
multiple of 8, no change is needed.
The second expression (also absolute) gives the value to be stored
in the padding bytes. It (and the comma) may be omitted. If it is
omitted, the padding bytes are zero.
File: as.info, Node: App-File, Next: Ascii, Prev: Align, Up: Pseudo Ops
`.app-file STRING'
==================
`.app-file' (which may also be spelled `.file') tells `as' that we
are about to start a new logical file. STRING is the new file name.
In general, the filename is recognized whether or not it is surrounded
by quotes `"'; but if you wish to specify an empty file name is
permitted, you must give the quotes--`""'. This statement may go away
in future: it is only recognized to be compatible with old `as'
programs.
File: as.info, Node: Ascii, Next: Asciz, Prev: App-File, Up: Pseudo Ops
`.ascii "STRING"'...
====================
`.ascii' expects zero or more string literals (*note Strings::.)
separated by commas. It assembles each string (with no automatic
trailing zero byte) into consecutive addresses.
File: as.info, Node: Asciz, Next: Byte, Prev: Ascii, Up: Pseudo Ops
`.asciz "STRING"'...
====================
`.asciz' is just like `.ascii', but each string is followed by a
zero byte. The "z" in `.asciz' stands for "zero".
File: as.info, Node: Byte, Next: Comm, Prev: Asciz, Up: Pseudo Ops
`.byte EXPRESSIONS'
===================
`.byte' expects zero or more expressions, separated by commas.
Each expression is assembled into the next byte.
File: as.info, Node: Comm, Next: Data, Prev: Byte, Up: Pseudo Ops
`.comm SYMBOL , LENGTH '
========================
`.comm' declares a named common area in the bss section. Normally
`ld' reserves memory addresses for it during linking, so no partial
program defines the location of the symbol. Use `.comm' to tell `ld'
that it must be at least LENGTH bytes long. `ld' will allocate space
for each `.comm' symbol that is at least as long as the longest
`.comm' request in any of the partial programs linked. LENGTH is an
absolute expression.
File: as.info, Node: Data, Next: Desc, Prev: Comm, Up: Pseudo Ops
`.data SUBSECTION'
==================
`.data' tells `as' to assemble the following statements onto the
end of the data subsection numbered SUBSECTION (which is an absolute
expression). If SUBSECTION is omitted, it defaults to zero.
File: as.info, Node: Desc, Next: Double, Prev: Data, Up: Pseudo Ops
`.desc SYMBOL, ABS-EXPRESSION'
==============================
This directive sets the descriptor of the symbol (*note Symbol
Attributes::.) to the low 16 bits of an absolute expression.
File: as.info, Node: Double, Next: Eject, Prev: Desc, Up: Pseudo Ops
`.double FLONUMS'
=================
`.double' expects zero or more flonums, separated by commas. It
assembles floating point numbers.
File: as.info, Node: Eject, Next: Else, Prev: Double, Up: Pseudo Ops
`.eject'
========
Force a page break at this point, when generating assembly listings.
File: as.info, Node: Else, Next: Endif, Prev: Eject, Up: Pseudo Ops
`.else'
=======
`.else' is part of the `as' support for conditional assembly; *note
`.if': If.. It marks the beginning of a section of code to be
assembled if the condition for the preceding `.if' was false.
File: as.info, Node: Endif, Next: Equ, Prev: Else, Up: Pseudo Ops
`.endif'
========
`.endif' is part of the `as' support for conditional assembly; it
marks the end of a block of code that is only assembled conditionally.
*Note `.if': If.
File: as.info, Node: Equ, Next: Extern, Prev: Endif, Up: Pseudo Ops
`.equ SYMBOL, EXPRESSION'
=========================
This directive sets the value of SYMBOL to EXPRESSION. It is
synonymous with `.set'; *note `.set': Set..
File: as.info, Node: Extern, Next: File, Prev: Equ, Up: Pseudo Ops
`.extern'
=========
`.extern' is accepted in the source program--for compatibility with
other assemblers--but it is ignored. `as' treats all undefined
symbols as external.
File: as.info, Node: File, Next: Fill, Prev: Extern, Up: Pseudo Ops
`.file STRING'
==============
`.file' (which may also be spelled `.app-file') tells `as' that we
are about to start a new logical file. STRING is the new file name.
In general, the filename is recognized whether or not it is surrounded
by quotes `"'; but if you wish to specify an empty file name, you must
give the quotes--`""'. This statement may go away in future: it is
only recognized to be compatible with old `as' programs.
File: as.info, Node: Fill, Next: Float, Prev: File, Up: Pseudo Ops
`.fill REPEAT , SIZE , VALUE'
=============================
RESULT, SIZE and VALUE are absolute expressions. This emits REPEAT
copies of SIZE bytes. REPEAT may be zero or more. SIZE may be zero
or more, but if it is more than 8, then it is deemed to have the value
8, compatible with other people's assemblers. The contents of each
REPEAT bytes is taken from an 8-byte number. The highest order 4
bytes are zero. The lowest order 4 bytes are VALUE rendered in the
byte-order of an integer on the computer `as' is assembling for. Each
SIZE bytes in a repetition is taken from the lowest order SIZE bytes
of this number. Again, this bizarre behavior is compatible with other
people's assemblers.
SIZE and VALUE are optional. If the second comma and VALUE are
absent, VALUE is assumed zero. If the first comma and following
tokens are absent, SIZE is assumed to be 1.
File: as.info, Node: Float, Next: Global, Prev: Fill, Up: Pseudo Ops
`.float FLONUMS'
================
This directive assembles zero or more flonums, separated by commas.
It has the same effect as `.single'.
File: as.info, Node: Global, Next: hword, Prev: Float, Up: Pseudo Ops
`.global SYMBOL', `.globl SYMBOL'
=================================
`.global' makes the symbol visible to `ld'. If you define SYMBOL
in your partial program, its value is made available to other partial
programs that are linked with it. Otherwise, SYMBOL will take its
attributes from a symbol of the same name from another partial program
it is linked with.
Both spellings (`.globl' and `.global') are accepted, for
compatibility with other assemblers.
File: as.info, Node: hword, Next: Ident, Prev: Global, Up: Pseudo Ops
`.hword EXPRESSIONS'
====================
This expects zero or more EXPRESSIONS, and emits a 16 bit number
for each.
This directive is a synonym for both `.short' and `.word'.
File: as.info, Node: Ident, Next: If, Prev: hword, Up: Pseudo Ops
`.ident'
========
This directive is used by some assemblers to place tags in object
files. `as' simply accepts the directive for source-file
compatibility with such assemblers, but does not actually emit anything
for it.
File: as.info, Node: If, Next: Include, Prev: Ident, Up: Pseudo Ops
`.if ABSOLUTE EXPRESSION'
=========================
`.if' marks the beginning of a section of code which is only
considered part of the source program being assembled if the argument
(which must be an ABSOLUTE EXPRESSION) is non-zero. The end of the
conditional section of code must be marked by `.endif' (*note
`.endif': Endif.); optionally, you may include code for the
alternative condition, flagged by `.else' (*note `.else': Else..
The following variants of `.if' are also supported:
`.ifdef SYMBOL'
Assembles the following section of code if the specified SYMBOL
has been defined.
`.ifndef SYMBOL'
`ifnotdef SYMBOL'
Assembles the following section of code if the specified SYMBOL
has not been defined. Both spelling variants are equivalent.
File: as.info, Node: Include, Next: Int, Prev: If, Up: Pseudo Ops
`.include "FILE"'
=================
This directive provides a way to include supporting files at
specified points in your source program. The code from FILE is
assembled as if it followed the point of the `.include'; when the end
of the included file is reached, assembly of the original file
continues. You can control the search paths used with the `-I'
command-line option (*note Command-Line Options: Invoking.).
Quotation marks are required around FILE.
File: as.info, Node: Int, Next: Lcomm, Prev: Include, Up: Pseudo Ops
`.int EXPRESSIONS'
==================
Expect zero or more EXPRESSIONS, of any section, separated by
commas. For each expression, emit a 32-bit number that will, at run
time, be the value of that expression. The byte order of the
expression depends on what kind of computer will run the program.
File: as.info, Node: Lcomm, Next: Lflags, Prev: Int, Up: Pseudo Ops
`.lcomm SYMBOL , LENGTH'
========================
Reserve LENGTH (an absolute expression) bytes for a local common
denoted by SYMBOL. The section and value of SYMBOL are those of the
new local common. The addresses are allocated in the bss section, so
at run-time the bytes will start off zeroed. SYMBOL is not declared
global (*note `.global': Global.), so is normally not visible to `ld'.
File: as.info, Node: Lflags, Next: Line, Prev: Lcomm, Up: Pseudo Ops
`.lflags'
=========
`as' accepts this directive, for compatibility with other
assemblers, but ignores it.
File: as.info, Node: Line, Next: Ln, Prev: Lflags, Up: Pseudo Ops
`.line LINE-NUMBER'
===================
Tell `as' to change the logical line number. LINE-NUMBER must be
an absolute expression. The next line will have that logical line
number. So any other statements on the current line (after a statement
separator character `;') will be reported as on logical line number
LINE-NUMBER - 1. One day this directive will be unsupported: it is
used only for compatibility with existing assembler programs.
File: as.info, Node: Ln, Next: List, Prev: Line, Up: Pseudo Ops
`.ln LINE-NUMBER'
=================
`.ln' is a synonym for `.line'.
File: as.info, Node: List, Next: Long, Prev: Ln, Up: Pseudo Ops
`.list'
=======
Control (in conjunction with the `.nolist' directive) whether or
not assembly listings are generated. These two directives maintain an
internal counter (which is zero initially). `.list' increments the
counter, and `.nolist' decrements it. Assembly listings are generated
whenever the counter is greater than zero.
By default, listings are disabled. When you enable them (with the
`-a' command line option; *note Command-Line Options: Invoking.), the
initial value of the listing counter is one.
File: as.info, Node: Long, Next: Lsym, Prev: List, Up: Pseudo Ops
`.long EXPRESSIONS'
===================
`.long' is the same as `.int', *note `.int': Int..
File: as.info, Node: Lsym, Next: Nolist, Prev: Long, Up: Pseudo Ops
`.lsym SYMBOL, EXPRESSION'
==========================
`.lsym' creates a new symbol named SYMBOL, but does not put it in
the hash table, ensuring it cannot be referenced by name during the
rest of the assembly. This sets the attributes of the symbol to be
the same as the expression value:
OTHER = DESCRIPTOR = 0
TYPE = (section of EXPRESSION)
VALUE = EXPRESSION
The new symbol is not flagged as external.
File: as.info, Node: Nolist, Next: Octa, Prev: Lsym, Up: Pseudo Ops
`.nolist'
=========
Control (in conjunction with the `.list' directive) whether or not
assembly listings are generated. These two directives maintain an
internal counter (which is zero initially). `.list' increments the
counter, and `.nolist' decrements it. Assembly listings are generated
whenever the counter is greater than zero.
File: as.info, Node: Octa, Next: Org, Prev: Nolist, Up: Pseudo Ops
`.octa BIGNUMS'
===============
This directive expects zero or more bignums, separated by commas.
For each bignum, it emits a 16-byte integer.
The term "octa" comes from contexts in which a "word" is two bytes;
hence *octa*-word for 16 bytes.
File: as.info, Node: Org, Next: Psize, Prev: Octa, Up: Pseudo Ops
`.org NEW-LC , FILL'
====================
`.org' will advance the location counter of the current section to
NEW-LC. NEW-LC is either an absolute expression or an expression with
the same section as the current subsection. That is, you can't use
`.org' to cross sections: if NEW-LC has the wrong section, the `.org'
directive is ignored. To be compatible with former assemblers, if the
section of NEW-LC is absolute, `as' will issue a warning, then pretend
the section of NEW-LC is the same as the current subsection.
`.org' may only increase the location counter, or leave it
unchanged; you cannot use `.org' to move the location counter
backwards.
Because `as' tries to assemble programs in one pass NEW-LC may not
be undefined. If you really detest this restriction we eagerly await
a chance to share your improved assembler.
Beware that the origin is relative to the start of the section, not
to the start of the subsection. This is compatible with other
people's assemblers.
When the location counter (of the current subsection) is advanced,
the intervening bytes are filled with FILL which should be an absolute
expression. If the comma and FILL are omitted, FILL defaults to zero.
File: as.info, Node: Psize, Next: Quad, Prev: Org, Up: Pseudo Ops
`.psize LINES , COLUMNS'
========================
Use this directive to declare the number of lines--and, optionally,
the number of columns--to use for each page, when generating listings.
If you don't use `.psize', listings will use a default line-count
of 60. You may omit the comma and COLUMNS specification; the default
width is 200 columns.
`as' will generate formfeeds whenever the specified number of lines
is exceeded (or whenever you explicitly request one, using `.eject').
If you specify LINES as `0', no formfeeds are generated save those
explicitly specified with `.eject'.
File: as.info, Node: Quad, Next: Sbttl, Prev: Psize, Up: Pseudo Ops
`.quad BIGNUMS'
===============
`.quad' expects zero or more bignums, separated by commas. For
each bignum, it emits an 8-byte integer. If the bignum won't fit in 8
bytes, it prints a warning message; and just takes the lowest order 8
bytes of the bignum.
The term "quad" comes from contexts in which a "word" is two bytes;
hence *quad*-word for 8 bytes.
File: as.info, Node: Sbttl, Next: Set, Prev: Quad, Up: Pseudo Ops
`.sbttl "SUBHEADING"'
=====================
Use SUBHEADING as the title (third line, immediately after the
title line) when generating assembly listings.
This directive affects subsequent pages, as well as the current
page if it appears within ten lines of the top of a page.
File: as.info, Node: Set, Next: Short, Prev: Quad, Up: Pseudo Ops
`.set SYMBOL, EXPRESSION'
=========================
This directive sets the value of SYMBOL to EXPRESSION. This will
change SYMBOL's value and type to conform to EXPRESSION. If SYMBOL
was flagged as external, it remains flagged. (*Note Symbol
Attributes::.)
You may `.set' a symbol many times in the same assembly. If the
expression's section is unknowable during pass 1, a second pass over
the source program will be forced. The second pass is currently not
implemented. `as' will abort with an error message if one is required.
If you `.set' a global symbol, the value stored in the object file
is the last value stored into it.
File: as.info, Node: Short, Next: Single, Prev: Set, Up: Pseudo Ops
`.short EXPRESSIONS'
====================
`.short' is the same as `.word'. *Note `.word': Word.
File: as.info, Node: Single, Next: Space, Prev: Short, Up: Pseudo Ops
`.single FLONUMS'
=================
This directive assembles zero or more flonums, separated by commas.
It has the same effect as `.float'.
File: as.info, Node: Space, Next: Stab, Prev: Single, Up: Pseudo Ops
`.space SIZE , FILL'
====================
This directive emits SIZE bytes, each of value FILL. Both SIZE and
FILL are absolute expressions. If the comma and FILL are omitted,
FILL is assumed to be zero.
File: as.info, Node: Stab, Next: Text, Prev: Space, Up: Pseudo Ops
`.stabd, .stabn, .stabs'
========================
There are three directives that begin `.stab'. All emit symbols
(*note Symbols::.), for use by symbolic debuggers. The symbols are
not entered in the `as' hash table: they cannot be referenced
elsewhere in the source file. Up to five fields are required:
STRING
This is the symbol's name. It may contain any character except
`\000', so is more general than ordinary symbol names. Some
debuggers used to code arbitrarily complex structures into symbol
names using this field.
TYPE
An absolute expression. The symbol's type is set to the low 8
bits of this expression. Any bit pattern is permitted, but `ld'
and debuggers will choke on silly bit patterns.
OTHER
An absolute expression. The symbol's "other" attribute is set to
the low 8 bits of this expression.
DESC
An absolute expression. The symbol's descriptor is set to the
low 16 bits of this expression.
VALUE
An absolute expression which becomes the symbol's value.
If a warning is detected while reading a `.stabd', `.stabn', or
`.stabs' statement, the symbol has probably already been created and
you will get a half-formed symbol in your object file. This is
compatible with earlier assemblers!
`.stabd TYPE , OTHER , DESC'
The "name" of the symbol generated is not even an empty string.
It is a null pointer, for compatibility. Older assemblers used a
null pointer so they didn't waste space in object files with empty
strings.
The symbol's value is set to the location counter, relocatably.
When your program is linked, the value of this symbol will be
where the location counter was when the `.stabd' was assembled.
`.stabn TYPE , OTHER , DESC , VALUE'
The name of the symbol is set to the empty string `""'.
`.stabs STRING , TYPE , OTHER , DESC , VALUE'
All five fields are specified.
File: as.info, Node: Text, Next: Title, Prev: Stab, Up: Pseudo Ops
`.text SUBSECTION'
==================
Tells `as' to assemble the following statements onto the end of the
text subsection numbered SUBSECTION, which is an absolute expression.
If SUBSECTION is omitted, subsection number zero is used.
File: as.info, Node: Title, Next: Word, Prev: Text, Up: Pseudo Ops
`.title "HEADING"'
==================
Use HEADING as the title (second line, immediately after the source
file name and pagenumber) when generating assembly listings.
This directive affects subsequent pages, as well as the current
page if it appears within ten lines of the top of a page.
File: as.info, Node: Word, Next: Deprecated, Prev: Text, Up: Pseudo Ops
`.word EXPRESSIONS'
===================
This directive expects zero or more EXPRESSIONS, of any section,
separated by commas. For each expression, `as' emits a 16-bit number.
*Warning: Special Treatment to support Compilers*
In order to assemble compiler output into something that will work,
`as' will occasionlly do strange things to `.word' directives.
Directives of the form `.word sym1-sym2' are often emitted by
compilers as part of jump tables. Therefore, when `as' assembles a
directive of the form `.word sym1-sym2', and the difference between
`sym1' and `sym2' does not fit in 16 bits, `as' will create a
"secondary jump table", immediately before the next label. This
secondary jump table will be preceded by a short-jump to the first
byte after the secondary table. This short-jump prevents the flow of
control from accidentally falling into the new table. Inside the
table will be a long-jump to `sym2'. The original `.word' will
contain `sym1' minus the address of the long-jump to `sym2'.
If there were several occurrences of `.word sym1-sym2' before the
secondary jump table, all of them will be adjusted. If there was a
`.word sym3-sym4', that also did not fit in sixteen bits, a long-jump
to `sym4' will be included in the secondary jump table, and the
`.word' directives will be adjusted to contain `sym3' minus the
address of the long-jump to `sym4'; and so on, for as many entries in
the original jump table as necessary.
File: as.info, Node: Deprecated, Prev: Word, Up: Pseudo Ops
Deprecated Directives
=====================
One day these directives won't work. They are included for
compatibility with older assemblers.
.abort
.app-file
.line
File: as.info, Node: M68K-Dependent, Next: Copying, Prev: Pseudo Ops, Up: Top
M680x0 Dependent Features
*************************
* Menu:
* M68K-Opts:: M680x0 Options
* M68K-Syntax:: Syntax
* M68K-Float:: Floating Point
* M68K-Directives:: 680x0 Machine Directives
* M68K-opcodes:: Opcodes
File: as.info, Node: M68K-Opts, Next: M68K-Syntax, Prev: M68K-Dependent, Up: M68K-Dependent
M680x0 Options
==============
The Motorola 680x0 version of `as' has two machine dependent
options. One shortens undefined references from 32 to 16 bits, while
the other is used to tell `as' what kind of machine it is assembling
for.
You can use the `-l' option to shorten the size of references to
undefined symbols. If the `-l' option is not given, references to
undefined symbols will be a full long (32 bits) wide. (Since `as'
cannot know where these symbols will end up, `as' can only allocate
space for the linker to fill in later. Since `as' doesn't know how
far away these symbols will be, it allocates as much space as it can.)
If this option is given, the references will only be one word wide (16
bits). This may be useful if you want the object file to be as small
as possible, and you know that the relevant symbols will be less than
17 bits away.
The 680x0 version of `as' is most frequently used to assemble
programs for the Motorola MC68020 microprocessor. Occasionally it is
used to assemble programs for the mostly similar, but slightly
different MC68000 or MC68010 microprocessors. You can give `as' the
options `-m68000', `-mc68000', `-m68010', `-mc68010', `-m68020', and
`-mc68020' to tell it what processor is the target.
File: as.info, Node: M68K-Syntax, Next: M68K-Float, Prev: M68K-Opts, Up: M68K-Dependent
Syntax
======
The 680x0 version of `as' uses syntax similar to the Sun assembler.
Size modifiers are appended directly to the end of the opcode without
an intervening period. For example, write `movl' rather than `move.l'.
In the following table "apc" stands for any of the address
registers (`a0' through `a7'), nothing, (`'), the Program Counter
(`pc'), or the zero-address relative to the program counter (`zpc').
The following addressing modes are understood:
"Immediate"
`#DIGITS'
"Data Register"
`d0' through `d7'
"Address Register"
`a0' through `a7'
"Address Register Indirect"
`a0@' through `a7@'
"Address Register Postincrement"
`a0@+' through `a7@+'
"Address Register Predecrement"
`a0@-' through `a7@-'
"Indirect Plus Offset"
`APC@(DIGITS)'
"Index"
`APC@(DIGITS,REGISTER:SIZE:SCALE)'
or `APC@(REGISTER:SIZE:SCALE)'
"Postindex"
`APC@(DIGITS)@(DIGITS,REGISTER:SIZE:SCALE)'
or `APC@(DIGITS)@(REGISTER:SIZE:SCALE)'
"Preindex"
`APC@(DIGITS,REGISTER:SIZE:SCALE)@(DIGITS)'
or `APC@(REGISTER:SIZE:SCALE)@(DIGITS)'
"Memory Indirect"
`APC@(DIGITS)@(DIGITS)'
"Absolute"
`SYMBOL', or `DIGITS'
File: as.info, Node: M68K-Float, Next: M68K-Directives, Prev: M68K-Syntax, Up: M68K-Dependent
Floating Point
==============
The floating point code is not too well tested, and may have subtle
bugs in it.
Packed decimal (P) format floating literals are not supported.
Feel free to add the code!
The floating point formats generated by directives are these.
`.float'
`Single' precision floating point constants.
`.double'
`Double' precision floating point constants.
There is no directive to produce regions of memory holding extended
precision numbers, however they can be used as immediate operands to
floating-point instructions. Adding a directive to create extended
precision numbers would not be hard, but it has not yet seemed
necessary.
File: as.info, Node: M68K-Directives, Next: M68K-opcodes, Prev: M68K-Float, Up: M68K-Dependent
680x0 Machine Directives
========================
In order to be compatible with the Sun assembler the 680x0 assembler
understands the following directives.
`.data1'
This directive is identical to a `.data 1' directive.
`.data2'
This directive is identical to a `.data 2' directive.
`.even'
This directive is identical to a `.align 1' directive.
`.skip'
This directive is identical to a `.space' directive.
File: as.info, Node: M68K-opcodes, Prev: M68K-Directives, Up: M68K-Dependent
Opcodes
=======
* Menu:
* M68K-Branch:: Branch Improvement
* M68K-Chars:: Special Characters
File: as.info, Node: M68K-Branch, Next: M68K-Chars, Prev: M68K-opcodes, Up: M68K-opcodes
Branch Improvement
------------------
Certain pseudo opcodes are permitted for branch instructions. They
expand to the shortest branch instruction that will reach the target.
Generally these mnemonics are made by substituting `j' for `b' at the
start of a Motorola mnemonic.
The following table summarizes the pseudo-operations. A `*' flags
cases that are more fully described after the table:
Displacement
+---------------------------------------------------------
| 68020 68000/10
Pseudo-Op |BYTE WORD LONG LONG non-PC relative
+---------------------------------------------------------
jbsr |bsrs bsr bsrl jsr jsr
jra |bras bra bral jmp jmp
* jXX |bXXs bXX bXXl bNXs;jmpl bNXs;jmp
* dbXX |dbXX dbXX dbXX; bra; jmpl
* fjXX |fbXXw fbXXw fbXXl fbNXw;jmp
XX: condition
NX: negative of condition XX
`*'--see full description below
`jbsr'
`jra'
These are the simplest jump pseudo-operations; they always map to
one particular machine instruction, depending on the displacement
to the branch target.
`jXX'
Here, `jXX' stands for an entire family of pseudo-operations,
where XX is a conditional branch or condition-code test. The full
list of pseudo-ops in this family is:
jhi jls jcc jcs jne jeq jvc
jvs jpl jmi jge jlt jgt jle
For the cases of non-PC relative displacements and long
displacements on the 68000 or 68010, `as' will issue a longer
code fragment in terms of NX, the opposite condition to XX:
jXX foo
gives
bNXs oof
jmp foo
oof:
`dbXX'
The full family of pseudo-operations covered here is
dbhi dbls dbcc dbcs dbne dbeq dbvc
dbvs dbpl dbmi dbge dblt dbgt dble
dbf dbra dbt
Other than for word and byte displacements, when the source reads
`dbXX foo', `as' will emit
dbXX oo1
bra oo2
oo1:jmpl foo
oo2:
`fjXX'
This family includes
fjne fjeq fjge fjlt fjgt fjle fjf
fjt fjgl fjgle fjnge fjngl fjngle fjngt
fjnle fjnlt fjoge fjogl fjogt fjole fjolt
fjor fjseq fjsf fjsne fjst fjueq fjuge
fjugt fjule fjult fjun
For branch targets that are not PC relative, `as' emits
fbNX oof
jmp foo
oof:
when it encounters `fjXX foo'.
File: as.info, Node: M68K-Chars, Prev: M68K-Branch, Up: M68K-opcodes
Special Characters
------------------
The immediate character is `#' for Sun compatibility. The
line-comment character is `|'. If a `#' appears at the beginning of a
line, it is treated as a comment unless it looks like `# line file',
in which case it is treated normally.